package com.gitee.hermer.engine.jars.app.sdk.configuration;

import org.springframework.context.annotation.DeferredImportSelector;
import org.springframework.core.type.AnnotationMetadata;

import com.gitee.hermer.boot.jee.commons.reflect.ClassUtils;
import com.gitee.hermer.engine.jars.core.domain.EngineConstant;

public class EngineConfigurationSelector implements DeferredImportSelector{

	@Override
	public String[] selectImports(AnnotationMetadata importingClassMetadata) {
		try{
			if(ClassUtils.isAssignableValue(EngineConstant.CLASS_ENGINE_APP_CLASS_LOADER, Thread.currentThread().getContextClassLoader())){
				return new String[] {EngineConstant.CLASS_NAME_ENGINE_APP_CONFIGURATION};
			}
		}catch (Exception e) {
		}
		return new String[] {EngineConstant.CLASS_NAME_ENGINE_CONFIGURATION};
	}

}
